import request from '@/utils/request'

/**
 * 楼盘签约详情
 * 新增 编辑 查询
 * @param {*} data id method
 * @returns
 */
export function signingRealEstate(data, id, method) {
  let url = `/api/v1/signingRealEstate/${id}`
  if (data) {
    url = '/api/v1/signingRealEstate'
  }
  return request({
    url: url,
    method: method || 'POST',
    headers: {
      'Permission-perCode': 'signmng',
      'Permission-App': 'slm'
    },
    data
  })
}

/**
 * 根据客户编码获取办事处客户经理等信息
 * @param {*} customerCode
 * @returns
 */
export const getSigningRealEstateCustomer = async(customerCode) => {
  const res = await request({
    url: `/api/v1/signingRealEstate/getSigningRealEstateCustomer/${customerCode}`,
    method: 'get'
  })
  return res && res.data
}

/**
 * 签约楼盘信息 列表批量删除
 * @param {Array} ids
 * @returns
 */
export function delSigningReal(ids) {
  return request({
    url: `/api/v1/signingRealEstate/deleteBatch`,
    method: 'delete',
    data: ids
  })
}

/**
 * 签约楼盘信息 批量停用
 * @param {Array} ids
 * @returns
 */
export function disableSigningReal(ids) {
  return request({
    url: `/api/v1/signingRealEstate/disable`,
    method: 'post',
    data: ids
  })
}
/**
 * 签约楼盘信息 批量停用
 * @param {Array} ids
 * @returns
 */
export function enableSigningReal(ids) {
  return request({
    url: `/api/v1/signingRealEstate/enable`,
    method: 'post',
    data: ids
  })
}

/**
 * 不建设样板间
 * @param {Array} ids
 * @returns
 */
export function doNotBuildModelRoom(ids) {
  return request({
    url: `/api/v1/signingRealEstate/doNotBuildModelRoom`,
    method: 'post',
    data: ids
  })
}

import qs from 'qs'
/**
 * getPerson
 */
export function getPerson(data) {
  return request({
    url: `/api/v1/signingRealEstate/getPerson`,
    method: 'post',
    data: qs.stringify(data)
  })
}
